//获取应用实例
var app = getApp()
var user = {};
var createRoomUrl = "http://localhost:8888/room/create"
Page({
  data: {
   
    user : {}
  },
  join:function(){

  },
  create:function(e){
    wx.request({
      url: createRoomUrl,
      data: {},
      method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
      // header: {}, // 设置请求的 header
      success: function(res){
         if(res.errMsg=="request:ok"&&res.data.code=="200"){
          var roomid = res.data.result;
           app.setRoomNo(roomid);
          app.getLoginUser()["rid"]=roomid;
           wx.navigateTo({
                    url: '/pages/index/index',
                    success: function(res){
                      // success
                    },
                    fail: function() {
                      // fail
                    },
                    complete: function() {
                      // complete
                    }
                  });
         }
      },
      fail: function() {
        // fail
      },
      complete: function() {
        // complete
      }
    })
  },
  onLoad: function () {
  	
  }
})